package com.newx.common.core.enums.business;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 期权订单标记枚举
 *
 * @author LionLi
 */
@Getter
@AllArgsConstructor
public enum SecondOrderSignEnum {
    /**
     * 正常
     */
    NORMAL(1, "正常"),

    /**
     * 包赢
     */
    GUARANTEED_WIN(2, "包赢"),

    /**
     * 包输
     */
    GUARANTEED_LOSS(3, "包输");

    private final Integer code;
    private final String info;

    /**
     * 根据code获取枚举
     *
     * @param code 代码
     * @return 对应的枚举，如果没有找到则返回null
     */
    public static SecondOrderSignEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (SecondOrderSignEnum sign : values()) {
            if (sign.getCode().equals(code)) {
                return sign;
            }
        }
        return null;
    }
}
